package one_06_array;

public class ArrayDemo04 {
    public static void main(String[] args) {
        int[] arrays = {1,2,3,4};
        method(arrays);

        System.out.println(method02(arrays));
    }
    // 打印数组
    public static void method(int[] arrays){
        for (int i = 0; i < arrays.length; i++) {
            System.out.println(arrays[i]);
        }
    }

    // 反转数组
    public static int[] method02(int[] arrays){
        int[] arr = new int[arrays.length];
        for (int i = 0; i < arrays.length; i++) {
            arr[i] = arrays[arrays.length-i-1];
        }
        return arr;
    }
}
